package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.ResultMapVO3;
import cn.tedu._04mybatis.pojo.vo.SelectCommentById1;
import cn.tedu._04mybatis.pojo.vo.SelectCommentById2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
//    @Insert("INSERT INTO comment(content,created,user_id,weibo_id)" +
//            "VALUES (#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);
    @Delete("DELETE FROM comment WHERE id=#{id}")
    int deleteCommentById(Long id);
    @Update("UPDATE comment SET content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} " +
            "WHERE id=#{id}" )
    int updateComment(Comment comment);

    @Select("SELECT content,user_id userId,weibo_id weiboId FROM comment WHERE id=#{commentId}")
    SelectCommentById1 selectCommentById1(Long commentId);
    @Select("SELECT content,user_id userId FROM comment WHERE weibo_id=#{weiboId}")
    List<SelectCommentById2> selectCommentById2(Long weiboId);


    ResultMapVO3 selectResultMapVO3(Long weiboId);




}
